
<?php 
echo $str = '1,2';
echo '<br/>';
echo substr($str,0,strpos($str,','));
echo '<br/>';
echo substr($str,strrpos($str,',')+1);

?>